home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls085.solintel.Z / tls085.solintel / lib / vtcl / tests / fsb.tcl < prev    next >
Encoding:
Text File  |  1995-07-20  |  2.9 KB  |  141 lines

  1. # CVS $Id: fsb.tcl,v 1.3 1995/02/03 16:54:47 zibi Exp $
  2. #
  3. # Example program for fileselection box
  4. #
  5.  
  6. set first_but True
  7.  
  8. proc quitCB {cbs} {
  9.     VtClose
  10.     exit 0
  11. }
  12.  
  13.  
  14. proc okCB {cbs} {
  15.      global rc
  16.  
  17.      #
  18.      # Getting value via callback parameter
  19.      #
  20.      set cb_value [keylget cbs selection]
  21.  
  22.      set wl [split $cb_value "/"]
  23.      set wi [expr "[llength $wl] - 1"]
  24.      set file [lindex $wl $wi]
  25.  
  26.      VtSetValues $rc.file -value $file
  27. }
  28.  
  29.  
  30. proc defaultCB {cbs} {
  31.  
  32.     set but [keylget cbs widget]
  33.  
  34.     set fsb1 [VtFileSelectionDialog $but.default  \
  35.                     -title "Default Fsb" \
  36.                     -okCallback okCB]
  37.     VtShow $fsb1
  38. }
  39.  
  40. proc labelsCB {cbs} {
  41.     set but [keylget cbs widget]
  42.  
  43.     set fsb2 [VtFileSelectionDialog $but.default \
  44.                     -title "Fsb with Button Labels"\
  45.                     -filterLabel FILTER_STR_LABEL \
  46.                     -fileListLabel FILE_LIST_LABEL \
  47.                     -dirListLabel DIR_LIST_LABEL \
  48.                     -selectionLabel SELECTION_LABEL\
  49.                     -okLabel OK_LABEL \
  50.                     -applyLabel FILTER_LABEL \
  51.                     -helpLabel HELP_LABEL \
  52.                     -cancelLabel CANCEL_LABEL \
  53.                     -okCallback okCB]
  54.     VtShow $fsb2
  55. }
  56.  
  57. proc hideDirListCB {cbs} {
  58.     set but [keylget cbs widget]
  59.  
  60.     set fsb3 [VtFileSelectionDialog $but.default \
  61.                     -title "No Directory List" \
  62.                     -hideDirList \
  63.                     -okCallback okCB]
  64.     VtShow $fsb3
  65. }
  66.  
  67. proc hideDirListAndFilterCB {cbs} {
  68.     set but [keylget cbs widget]
  69.  
  70.     set fsb4 [VtFileSelectionDialog $but.default \
  71.                         -title "Files in /etc/default" \
  72.                         -filter /etc/default/* \
  73.                         -hideFilter \
  74.                         -hideDirList \
  75.                         -okCallback okCB]
  76.     VtShow $fsb4
  77. }
  78.  
  79. proc selectionCB {cbs} {
  80.     set but [keylget cbs widget]
  81.  
  82.     set fsb5 [VtFileSelectionDialog $but.default  \
  83.                       -title "-selection /etc/default/filesys" \
  84.                       -filter /etc/default/* \
  85.                       -selection /etc/default/filesys \
  86.                       -okCallback okCB]
  87.     VtShow $fsb5
  88.  
  89. proc cancelCB {cbs} {
  90.     set box [keylget cbs widget]
  91.     VtHide $box
  92. }
  93.  
  94. proc autoHideCB {cbs} {
  95.     global first_but
  96.     global fsb6
  97.  
  98.     set but [keylget cbs widget]
  99.  
  100.     if {$first_but == "True"} {
  101.         set fsb6 [VtFileSelectionDialog $but.default  \
  102.                 -title "-autoHide False w/ cancelCB" \
  103.                 -autoHide False \
  104.                 -autoDestroy False \
  105.                 -cancelCallback cancelCB]
  106.         set first_but False
  107.     }
  108.     VtShow $fsb6
  109. }
  110.  
  111.  
  112.  
  113. #
  114. # Start Program
  115. #
  116. #
  117. set app [VtOpen fsb]
  118.  
  119. set fn [VtStartForm $app.form -title "Fsb's" ]
  120.  
  121. set rc [VtRowColumn $fn.rc1]
  122. VtPushButton $rc.but1 -label "Default fsb" \
  123.               -callback defaultCB
  124. VtPushButton $rc.but2 -label "Changing Widget Labels" \
  125.               -callback labelsCB
  126. VtPushButton $rc.but3 -label -hideDirList \
  127.               -callback hideDirListCB
  128. VtPushButton $rc.but4 -label "-hideDirList and -hideDirFilter "\
  129.                       -callback hideDirListAndFilterCB 
  130. VtPushButton $rc.but5 -label -selection \
  131.                       -callback selectionCB
  132. VtPushButton $rc.but6 -label "-autoHide False" \
  133.                       -callback autoHideCB
  134. VtText $rc.file -readOnly
  135. VtPushButton $rc.but9 -label QUIT \
  136.               -callback quitCB 
  137.  
  138. VtShow $fn
  139. VtMainLoop
  140.